/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2010
 */

package com.sisterandbrother.service;

import java.util.List;

import javacommon.base.BaseManager;
import javacommon.base.EntityDao;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.org.rapid_framework.page.Page;

import com.sisterandbrother.dao.ChatMsgDao;
import com.sisterandbrother.model.ChatMsg;
import com.sisterandbrother.query.ChatMsgQuery;

/**
 * @author badqiu email:badqiu(a)gmail.com
 * @version 1.0
 * @since 1.0
 */

@Service("chatMsgManager")
@Transactional
public class ChatMsgManager extends BaseManager<ChatMsg, Long> {

	private ChatMsgDao chatMsgDao;

	public void setChatMsgDao(ChatMsgDao dao) {
		this.chatMsgDao = dao;
	}

	@SuppressWarnings("rawtypes")
	public EntityDao getEntityDao() {
		return this.chatMsgDao;
	}

	@SuppressWarnings("rawtypes")
	@Transactional(readOnly = true)
	public Page findPage(ChatMsgQuery query) {
		return chatMsgDao.findPage(query);
	}

	@Transactional(readOnly = true)
	public List<ChatMsg> findBySenderName(String senderName) {
		return chatMsgDao.findAllBy("senderName", senderName);
	}

	@Transactional(readOnly = true)
	public List<ChatMsg> findByQuery(ChatMsgQuery query) {
		return chatMsgDao.findByQuery(query);

	}
}
